<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
  <meta charset="utf-8" />
  <title>水果信息</title>
  <link rel="stylesheet" type="text/css" href="css/imgs.css"/>
  <link rel="stylesheet" type="text/css" href="css/main.css"/>
  <script src="js/imgs.js" type="text/javascript" charset="utf-8"></script>
  <script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
</head>
<script type="text/javascript " charset="utf-8">
	$(function(){
	$("#cart" ).click(function(){
 		var count =$("#count" ).text();
		var fid=$("#cart").attr("fid");
		location.href="/fruits/cart/AddCartServlet?fid="+fid+"&count="+count;
	}); 
	$("#numl").click(function(){
		var curcount =parseInt($("#count").text())-1;
		if(curcount<1){
			alert("购物车一次至少添加1份");
		}else{
			$("#count").text(curcount);
		}
		});
	$("#numr").click(function(){
		var curcount =parseInt($("#count").text())+1;
		if(curcount>5){
			alert("当次购物车最多5份");
	}else{
		$("#count").text(curcount);
	}
	});
	});

</script>
<body onload="show()">
<jsp:include page="head/head.jsp"></jsp:include>

<div class="fruit_info">
  <div class="img_box">
  	<c:forEach begin="1" end="${imgcount}" var="number">
  	<c:if test="${number==1}">
  		 <div id="p${number-1}" class="show"><img src="img/fruits/${thisfruit.fid}/(1).jpg" /></div>
  	</c:if>
  	<c:if test="${number!=1}">
  		 <div id="p${number-1}" class="non"><img src="img/fruits/${thisfruit.fid}/(${number}).jpg" /></div>
  	</c:if>
  		
  	</c:forEach>
  
<!-- <div id="p1" class="non"><img src="img/fruits/1/(2).jpg" /></div>
<div id="p2" class="non"><img src="img/fruits/1/(3).jpg" /></div> -->


    <div class="img_to">
      <ul >
            <c:forEach begin="1" end="${imgcount}" var="number">
            	 <li><img src="img/fruits/${thisfruit.fid}/(${number}).jpg" id="s${number-1}" onMouseMove="himg(this.id,${imgcount})"/></li>
            </c:forEach>
             <!-- <li><img src="img/fruits/1/(2).jpg" id="s1" onMouseMove="himg(this.id)"/></li>
             <li><img src="img/fruits/1/(3).jpg" id="s2" onMouseMove="himg(this.id)"/></li> -->

      </ul>
    </div>
  </div>

  <div class="fruit_text">
    <div class="fname">${thisfruit.fname}</div>
    <p>&nbsp;</p>
    <div class="spec"><input type="radio" checked="checked" name="fnum_radio" value="fnum_radio"/>${thisfruit.fnorm}</div>
    <div class="up">${thisfruit.fprice}</div>
    <div class="fid">商品编号：${thisfruit.fid}</div>

    <hr/>

    <form  method="post" id="fform">
      <div class="fform">
        <div class="fform1">
      <div class="Uaddress"> 配送至 :
        <select name="address" id="sel">
          <option value="上海">上海</option>
          <option value="吉林">吉林</option>
          <option value="山西">山西</option>
          <option value="北京">北京</option>
        </select>
		</div>
      <div class="Unum">
      <span id="numl" >-</span>
      <span id="count">1</span>
      <span id="numr" >+</span></div>
      </div>
          <div class="Uadd"><input type="button" name="add" id="cart" value="加入购物车" fid="${thisfruit.fid}"/></div>
          <c:if test="${empty starflag}">
          	<div class="starbutton">
          	<input type="button" name="add" id="star" value="关注商品" onclick="addStar(${thisfruit.fid})"/>
          	</div>
          </c:if>
          <c:if test="${not empty starflag}">
          	<div class="starbutton">
          	<input type="button" name="add" id="star" value="已关注" onclick="addStar(${thisfruit.fid})"/>
          	</div>
          </c:if>
      </div>
    </form>

    <hr />
    <div class="finfo">
      <h3>商品简介</h3>
      <p id="finfo_text">${thisfruit.fsummary}</p>

    </div>
    <hr />
    <div class="fpro">
      <h3>温馨提示</h3>
      <p id="fpro_text">${thisfruit.fprompt}</p>

    </div>
    <hr />
  </div>

  <div class="fruit_hot" >
    <div class="hf_title">
    	<span class="ht_l">热卖商品</span><span class="ht_r">
    	<a href="/fruits/fruit/LoadIndexServlet?page=fruit_info&pageNum=${hotinfo.pageNum+1}">MORE+</a></span>
    </div>
    <c:forEach items="${hotinfo.list}" var="fruit" begin="1" end="3">
     <div class="hot_fruit">
      <div class="hf_img">
      	<a href="/fruits/fruit/SearchFruitByFidServlet?fid=${fruit.fid}">
      		<img src="img/fruits/${fruit.fid}/(1).jpg" />
      	</a>
      </div>
      <div class="hf_text">
        <div class="hf_name">
        	<a href="/fruits/fruit/SearchFruitByFidServlet?fid=${fruit.fid}">${fruit.fname}</a>
        </div>
        <div class="hf_mon">
        	现货：￥<span>78.0</span>
        </div>
      </div>
    </div>  
    </c:forEach>
     
  </div>
</div>

<jsp:include page="footer/footer.jsp"></jsp:include>
</body>
</html>
